ga.core.individual.population
Interface IPopulation<T extends IIndividual<T>>

Type Parameters:
T - The generic type of individuals.
All Superinterfaces:
java.lang.Iterable<T>
All Known Subinterfaces:
IClusterPopulation<T>
All Known Implementing Classes:
ArrayListPopulation, KMeansClusterPopulation

public interface IPopulation<T extends IIndividual<T>>
extends java.lang.Iterable<T>

Common interface for populations of a GA.

Since:
11.08.2012
Author:
Stephan Dreyer

Method Summary
 void addIndividual(T individual)
          Adds an individual to the population.
 void addIndividuals(IndividualList<T> individuals)
          Adds individuals to the population.
 void addIndividuals(T... individuals)
          Adds individuals to the population.
 void clear()
          Clears the population.
 boolean containsAny(IndividualList<T> list)
          Determine if one of the individuals is contained in this list.
 void evaluateAutomatic()
          Evaluates all individiduals using the automatic evaluator.
 T getEliteIndividual()
          Gets the elite individual, if elite strategy is used.
 int getEvaluatedIndividualCount()
          Get the number of individuals that has been evaluated.
 T getFittestIndividual()
          Gets the individual if the highest fitness.
 IndividualList<T> getIndividuals()
          Getter for a list representation of the population.
 int getInitIndividualCount()
          Get the number of initial individuals.
 T getRandomIndividualForEvaluation()
          Randomly selects an individual to evaluate.
 T getRandomIndividualForSelection()
          Randomly selects an individual to select.
 IndividualList<T> getUnevaluatedIndividuals()
          Get all individuals that has not been evaluated yet.
 T getUnfittestIndividual()
          Gets the individual if the lowest fitness.
 void initRandomly(IValidator<T> validator, GAContext context)
          Fill the population with random individuals.
 boolean isAllowDuplicates()
          Determines if duplicates are allowed.
 boolean isEmpty()
          Determines if the population is empty.
 java.util.Iterator<T> iterator()
           
 void setEvaluator(IFitnessEvaluator<T> evaluator)
          Sets the evaluator.
 void setInitIndividualCount(int individualCount)
          Set the number of initial individuals.
 int size()
          Returns the size of the population; the count of individuals.
 

Method Detail

initRandomly

void initRandomly(IValidator<T> validator,
                  GAContext context)
Fill the population with random individuals.

Parameters:
validator - The validator or null.
context - The GA context.
Since:
11.08.2012

setEvaluator

void setEvaluator(IFitnessEvaluator<T> evaluator)
Sets the evaluator.

Parameters:
evaluator - The evaluator.
Since:
11.08.2012

getIndividuals

IndividualList<T> getIndividuals()
Getter for a list representation of the population.

Returns:
The individuals as list.
Since:
11.08.2012

addIndividuals

void addIndividuals(T... individuals)
Adds individuals to the population.

Parameters:
individuals - Individuals to add.
Since:
11.08.2012

addIndividual

void addIndividual(T individual)
Adds an individual to the population.

Parameters:
individual - Individual to add.
Since:
11.08.2012

addIndividuals

void addIndividuals(IndividualList<T> individuals)
Adds individuals to the population.

Parameters:
individuals - Individuals to add.
Since:
11.08.2012

clear

void clear()
Clears the population.

Since:
11.08.2012

evaluateAutomatic

void evaluateAutomatic()
Evaluates all individiduals using the automatic evaluator.

Since:
11.08.2012

isEmpty

boolean isEmpty()
Determines if the population is empty.

Returns:
true if the population is empty.
Since:
11.08.2012

size

int size()
Returns the size of the population; the count of individuals.

Returns:
Size.
Since:
11.08.2012

getUnfittestIndividual

T getUnfittestIndividual()
Gets the individual if the lowest fitness.

Returns:
The unfittest individual.
Since:
11.08.2012

getFittestIndividual

T getFittestIndividual()
Gets the individual if the highest fitness.

Returns:
The fittest individual.
Since:
11.08.2012

getEliteIndividual

T getEliteIndividual()
Gets the elite individual, if elite strategy is used.

Returns:
The elite or null.
Since:
11.08.2012

getRandomIndividualForEvaluation

T getRandomIndividualForEvaluation()
Randomly selects an individual to evaluate.

Returns:
Random individual to evaluate.
Since:
11.08.2012

getUnevaluatedIndividuals

IndividualList<T> getUnevaluatedIndividuals()
Get all individuals that has not been evaluated yet.

Returns:
List of unevaluated individuals.
Since:
11.08.2012

getEvaluatedIndividualCount

int getEvaluatedIndividualCount()
Get the number of individuals that has been evaluated.

Returns:
Number of evaluated individuals.
Since:
11.08.2012

getInitIndividualCount

int getInitIndividualCount()
Get the number of initial individuals.

Returns:
Number of init individuals.
Since:
11.08.2012

setInitIndividualCount

void setInitIndividualCount(int individualCount)
Set the number of initial individuals.

Parameters:
individualCount - Number of init individuals.
Since:
11.08.2012

isAllowDuplicates

boolean isAllowDuplicates()
Determines if duplicates are allowed.

Returns:
true if duplicates are allowed.
Since:
11.08.2012

containsAny

boolean containsAny(IndividualList<T> list)
Determine if one of the individuals is contained in this list.

Parameters:
list - Individuals to look for.
Returns:
true if this list contains any individual of the other one.
Since:
11.08.2012

iterator

java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T extends IIndividual<T>>

getRandomIndividualForSelection

T getRandomIndividualForSelection()
Randomly selects an individual to select.

Returns:
Random individual to select.
Since:
11.08.2012